package com.eight.lotteryservice.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.eight.lotteryservice.config.ResBean;
import com.eight.lotteryservice.entity.RedUserHit;
import com.eight.lotteryservice.mapper.RedUserHitMapper;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author eight
 * @since 2022-08-20
 */
@RestController
@RequestMapping("/lotteryservice/red-user-hit")
public class RedUserHitController {

    @Resource
    RedUserHitMapper redUserHitMapper;

    @GetMapping("getHits")
    public ResBean getHis(){
        int game_id = 3;
        QueryWrapper<RedUserHit> queryWrapper= new QueryWrapper<>();
        queryWrapper.eq("gameid",game_id);
        queryWrapper.eq("productid",1);
        //查询一等奖的人数
        int x1=redUserHitMapper.selectCount(queryWrapper);

        QueryWrapper<RedUserHit> queryWrapper1= new QueryWrapper<>();
        queryWrapper.eq("gameid",game_id);
        queryWrapper.eq("productid",2);
        //查询一等奖的人数
        int x2=redUserHitMapper.selectCount(queryWrapper1);

        QueryWrapper<RedUserHit> queryWrapper2= new QueryWrapper<>();
        queryWrapper.eq("gameid",game_id);
        queryWrapper.eq("productid",3);
        //查询一等奖的人数
        int x3=redUserHitMapper.selectCount(queryWrapper);











        List<RedUserHit> list= redUserHitMapper.selectList(queryWrapper);
        ResBean resBean = new ResBean();
        resBean.setCode(1);
        resBean.setMsg("测试接口显示场次所有信息");
        resBean.setData(list);
        return resBean;
    }

}

